package com.xcity.pomelo.response;

import com.xcity.game.buildv2.BuildV2;
import com.xcity.game.item.ItemTemplate;
import com.xcity.pomelo.response.BuildTakeExpResponse.ExpDelta;
import com.xcity.pomelo.response.BuildV2Response.ExpBookTempInfo;
import com.xcity.pomelo.response.BuildV2Response.ExpExtendInfo;

import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.protocol.Message;

@PomeloMessage(type = Message.Type.RESPONSE)
public class EmployeeFreeResponse extends Response {

	public int buildId;
	public long id;
	public int pos;
//	@Deprecated
//	public int defense, reserve, cure; // 建筑抵抗力、储备力、自救力
	public ExpDelta expDelta;//经验变化
	public ExpBookTempInfo expBookInfo;//经验书相关简化信息
	public ExpExtendInfo expExtendInfo;
	public int lastTakeMoney;//上一次领过的钱
	public int takeMoneyElapseSec;//距离上一次开始产钱多少秒

//	@Deprecated
//	public EmployeeFreeResponse(int serial, Build build, long id, int pos) {
//		super(serial);
//		this.buildId = build.getId();
//		this.defense = (int) build.getDefense();
//		this.reserve = build.getReserve();
//		this.cure = build.getCure();
//		this.id = id;
//		this.pos = pos;
//	}
	
	public EmployeeFreeResponse(int serial, BuildV2 build, long id, int pos, ExpDelta expdelta) {
		super(serial);
		this.buildId = build.getId();
		this.id = id;
		this.pos = pos;
		this.expDelta = expdelta;
		ItemTemplate itemTemplate = build.tryGetExpBookTemplate();
		if(itemTemplate != null){
			this.expBookInfo = new ExpBookTempInfo(itemTemplate);
		}
		this.expExtendInfo = new ExpExtendInfo(build);
		this.lastTakeMoney = build.printAndResetLastTakeMoney();
		this.takeMoneyElapseSec = build.calcTakeMoneyElapseSecond();
	}

}
